﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

namespace IEWebSite.Administration
{
    public partial class GradDidacticStiintific : System.Web.UI.Page
    {
        SqlConnection sqlConn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["SiteIEConnectionString"].ConnectionString);
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GradDidBtnAdd_Click(object sender, EventArgs e)
        {
           
            try
            {
                sqlConn.Open();
                SqlCommand sqlCmd = new SqlCommand("INSERT INTO SysTitluDidactic(TitluDidactic) VALUES (@TitluDidactic)", sqlConn);
                sqlCmd.Parameters.Add(new SqlParameter("@TitluDidactic", txtGradDidactic.Text));
                sqlCmd.ExecuteNonQuery();
                txtGradDidactic.Text = "";
            }
            catch (Exception ex)
            {
                lblError.Text = "Eroare: " + ex.Message;
            }
            finally
            {
                sqlConn.Close();
            }
            gradDidGvName.DataBind();
        }

        protected void GradStiintBtnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                sqlConn.Open();
                SqlCommand sqlCmd = new SqlCommand("INSERT INTO SysTitluStiintific(TitluStiintific) VALUES (@TitluStiintific)", sqlConn);
                sqlCmd.Parameters.Add(new SqlParameter("@TitluStiintific", txtGrdStiintific.Text));
                sqlCmd.ExecuteNonQuery();
                txtGrdStiintific.Text = "";
            }
            catch (Exception ex)
            {
                lblError.Text = "Eroare: " + ex.Message;
            }
            finally
            {
                sqlConn.Close();
            }
            grdvGrdStiint.DataBind();
        }
    }
}
